package com.ruoyi.zsyh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhAgentAddressMapper;
import com.ruoyi.zsyh.domain.ZsyhAgentAddress;
import com.ruoyi.zsyh.service.IZsyhAgentAddressService;
import com.ruoyi.common.core.text.Convert;

/**
 * 大区会长收货地址Service业务层处理
 * 
 * @author yuexl
 * @date 2021-12-14
 */
@Service
public class ZsyhAgentAddressServiceImpl implements IZsyhAgentAddressService 
{
    @Autowired
    private ZsyhAgentAddressMapper zsyhAgentAddressMapper;

    /**
     * 查询大区会长收货地址
     * 
     * @param id 大区会长收货地址ID
     * @return 大区会长收货地址
     */
    @Override
    public ZsyhAgentAddress selectZsyhAgentAddressById(String id)
    {
        return zsyhAgentAddressMapper.selectZsyhAgentAddressById(id);
    }

    /**
     * 查询大区会长收货地址列表
     * 
     * @param zsyhAgentAddress 大区会长收货地址
     * @return 大区会长收货地址
     */
    @Override
    public List<ZsyhAgentAddress> selectZsyhAgentAddressList(ZsyhAgentAddress zsyhAgentAddress)
    {
        return zsyhAgentAddressMapper.selectZsyhAgentAddressList(zsyhAgentAddress);
    }

    /**
     * 新增大区会长收货地址
     * 
     * @param zsyhAgentAddress 大区会长收货地址
     * @return 结果
     */
    @Override
    public int insertZsyhAgentAddress(ZsyhAgentAddress zsyhAgentAddress)
    {
        zsyhAgentAddress.setCreateTime(DateUtils.getNowDate());
        return zsyhAgentAddressMapper.insertZsyhAgentAddress(zsyhAgentAddress);
    }

    /**
     * 修改大区会长收货地址
     * 
     * @param zsyhAgentAddress 大区会长收货地址
     * @return 结果
     */
    @Override
    public int updateZsyhAgentAddress(ZsyhAgentAddress zsyhAgentAddress)
    {
        zsyhAgentAddress.setUpdateTime(DateUtils.getNowDate());
        return zsyhAgentAddressMapper.updateZsyhAgentAddress(zsyhAgentAddress);
    }

    public int updateSetDefault(String agentId, String id){
        return zsyhAgentAddressMapper.updateSetDefault(agentId, id);
    }

    /**
     * 删除大区会长收货地址对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAgentAddressByIds(String ids)
    {
        return zsyhAgentAddressMapper.deleteZsyhAgentAddressByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除大区会长收货地址信息
     * 
     * @param id 大区会长收货地址ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAgentAddressById(String id)
    {
        return zsyhAgentAddressMapper.deleteZsyhAgentAddressById(id);
    }
}
